//
//  GCGlobals.m
//  GalaxyConqueror
//
//  Created by Test on 8/3/14.
//  Copyright (c) 2014 Stefan.Nestorov. All rights reserved.
//

#import "GCGlobals.h"

#define IS_WIDESCREEN ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )

@implementation GCGlobals

//returns correct Atlas / images for Iphone or Ipad /
+(SKTextureAtlas *)textureAtlasNamed:(NSString *)fileName
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
        
        if (IS_WIDESCREEN) {
            // iPhone Retina 4-inch
            fileName = [NSString stringWithFormat:@"%@-568", fileName];
            NSLog(@"4.0 inch Iphone !");
        } else {
            // iPhone Retina 3.5-inch
            NSLog(@"3.5 inch Iphone !");
            fileName = [NSString stringWithFormat:@"%@-568", fileName];
        }
        
    } else {
        fileName = [NSString stringWithFormat:@"%@-ipad", fileName];
        NSLog(@"Ipad !");
    }
    
    SKTextureAtlas *textureAtlas = [SKTextureAtlas atlasNamed:fileName];
    
    return textureAtlas;
}

@end
